<template>
  <div>
    <span>{{label}}：</span>
    <el-select v-model="val" placeholder="请选择" @change="handleChange">
      <el-option v-for="item in options" :key="item.value" :label="item.type" :value="item.value"></el-option>
    </el-select>
  </div>
</template>

<script>
export default {
  props: ["palceholder", "defaultVal", "label", "params"],
  data() {
    return {
      val: "",
      options: [
        {
          type: "类型1",
          value: 1
        },
        {
          type: "类型2",
          value: 2
        },
        {
          type: "类型3",
          value: 3
        }
      ]
    };
  },
  created() {
    if (this.defaultVal) {
      this.val = this.defaultVal;
    }
  },
  mounted() {},
  methods: {
    handleChange() {
      this.$emit("handleChange", this.params, this.val);
    },
    clear() {
      this.val = "";
    }
  }
};
</script>
